package marshall;

import org.jboss.marshalling.*;

public final class MarshallingCodecFactory {

    public static Marshaller buildMarshalling() throws Exception {
        MarshallerFactory marshallerFactory = Marshalling.
                getProvidedMarshallerFactory("serial");
        MarshallingConfiguration configuration = new MarshallingConfiguration();
        configuration.setVersion(5);
        Marshaller marshaller = marshallerFactory.createMarshaller(configuration);
        return marshaller;
    }

    public static Unmarshaller buildUnmarshalling() throws Exception {
        MarshallerFactory marshallerFactory = Marshalling.
                getProvidedMarshallerFactory("serial");
        MarshallingConfiguration configuration = new MarshallingConfiguration();
        configuration.setVersion(5);
        Unmarshaller unmarshaller = marshallerFactory.createUnmarshaller(configuration);
        return unmarshaller;
    }

}
